package com.my.springbootlogback.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum LogTypeEnum {

    INFO(1, "INFO"),
    WARN(2, "WARN"),
    DEBUG(3, "DEBUG"),
    ERROR(3, "ERROR")
    ;

    private Integer code;
    private String name;

    public static LogTypeEnum getEnumByCode(Integer code){
        for(LogTypeEnum anEnum: LogTypeEnum.values()){
            if(anEnum.getCode().equals(code)){
                return anEnum;
            }
        }
        return null;
    }
}
